|
In computing, a shebang is the character sequence consisting of the characters number sign and exclamation mark (''#!'') at the beginning of a script. It is also called sha-bang〔(【引用サイトリンク】url=http://tldp.org/LDP/abs/html/sha-bang.html )〕〔(【引用サイトリンク】url=http://www.in-ulm.de/~mascheck/various/shebang/ )〕 hashbang, pound-bang,〔 or hash-pling.〔 Under Unix-like operating systems, when a script with a shebang is run as a program, the program loader parses the rest of the script's initial line as an interpreter directive; the specified interpreter program is run instead, passing to it as an argument the path that was initially used when attempting to run the script.〔(【引用サイトリンク】url=http://linux.die.net/man/2/execve )〕 For example, if a script is named with the path ''path/to/script'', and it starts with the following line: : #!/bin/sh then the program loader is instructed to run the program ''/bin/sh'' instead, passing ''path/to/script'' as the first argument. The shebang line is usually ignored by the interpreter because the "#" character is a comment marker in many scripting languages; some language interpreters that do not use the hash mark to begin comments (such as Scheme) still may ignore the shebang line in recognition of its purpose.〔(SRFI 22 )〕 Other solutions rely on a preprocessor, which evaluates and removes the shebang line, before the remainder of the script is forwarded to a compiler or interpreter. This is e.g. the case with InstantFPC, a command that allows to run programs written in Free Pascal as scripts under several operating systems.〔(InstantFPC documentation )〕 ==Syntax== The form of a shebang interpreter directive is as follows:〔 : #!''interpreter'' () The ''interpreter'' must be an absolute path to an executable program (if this interpreter program is a script, it must contain a shebang as well). The ''optional‑arg'' should either not be included or it should be a string that is meant to be a single argument (for reasons of portability, it should not contain any whitespace). The blank after ''#!'' is optional.〔 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Shebang (Unix)」の詳細全文を読む スポンサード リンク
|